/**
 * HarmonyOS 三方库适配中心 - 全局样式
 * v1.0.0
 */

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #0066cc;
    --primary-hover: #0052a3;
    --success-color: #52c41a;
    --warning-color: #faad14;
    --error-color: #f5222d;
    --info-color: #1890ff;
    --text-primary: #262626;
    --text-secondary: #595959;
    --border-color: #d9d9d9;
    --bg-light: #fafafa;
    --bg-white: #ffffff;
    --shadow-sm: 0 2px 4px rgba(0, 0, 0, 0.08);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.12);
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: #f5f5f5;
    color: var(--text-primary);
    line-height: 1.6;
}

/* ============ 容器布局 ============ */

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* ============ 头部 ============ */

.header {
    background: linear-gradient(135deg, var(--primary-color) 0%, #0052a3 100%);
    color: white;
    padding: 40px 20px;
    text-align: center;
    margin-bottom: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow-md);
}

.header h1 {
    font-size: 32px;
    font-weight: 700;
    margin-bottom: 10px;
}

.header .subtitle {
    font-size: 14px;
    opacity: 0.9;
    letter-spacing: 0.5px;
}

/* ============ 导航 ============ */

.nav {
    background: var(--bg-white);
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 30px;
    border-radius: 4px;
    box-shadow: var(--shadow-sm);
    position: sticky;
    top: 0;
    z-index: 100;
}

.nav-list {
    list-style: none;
    display: flex;
    gap: 0;
}

.nav-link {
    display: block;
    padding: 16px 24px;
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
    border-bottom: 3px solid transparent;
    font-weight: 500;
}

.nav-link:hover,
.nav-link.active {
    color: var(--primary-color);
    border-bottom-color: var(--primary-color);
    background-color: var(--bg-light);
}

/* ============ 演示页面导航 ============ */

.demo-nav {
    margin-bottom: 20px;
}

.nav-back {
    display: inline-block;
    padding: 10px 16px;
    color: var(--primary-color);
    text-decoration: none;
    font-weight: 500;
    transition: var(--transition);
    border-radius: 4px;
}

.nav-back:hover {
    background-color: var(--bg-light);
}

/* ============ 主内容区 ============ */

.main-content {
    display: flex;
    flex-direction: column;
    gap: 30px;
}

.demo-section,
.docs-section,
.api-section {
    background: var(--bg-white);
    padding: 30px;
    border-radius: 8px;
    box-shadow: var(--shadow-sm);
}

.demo-section h2,
.docs-section h2,
.api-section h2 {
    font-size: 24px;
    margin-bottom: 20px;
    color: var(--text-primary);
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

/* ============ 控制条 ============ */

.controls {
    display: flex;
    gap: 12px;
    margin-bottom: 20px;
    flex-wrap: wrap;
    align-items: center;
}

.search-input,
.sort-select {
    padding: 10px 12px;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    font-size: 14px;
    transition: var(--transition);
}

.search-input {
    flex: 1;
    min-width: 200px;
}

.search-input:focus,
.sort-select:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0, 102, 204, 0.1);
}

.sort-select {
    min-width: 150px;
}

/* ============ 按钮 ============ */

.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 4px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition);
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background-color: var(--primary-color);
    color: white;
}

.btn-primary:hover {
    background-color: var(--primary-hover);
    box-shadow: var(--shadow-md);
}

.btn-primary:active {
    transform: scale(0.98);
}

/* ============ 表格样式 ============ */

.table-wrapper {
    overflow-x: auto;
    border-radius: 4px;
    border: 1px solid var(--border-color);
}

.data-table {
    width: 100%;
    border-collapse: collapse;
    background: var(--bg-white);
}

.table-header-row {
    background: linear-gradient(to right, #f0f2f5, #fafafa);
    border-bottom: 2px solid var(--border-color);
}

.table-header-cell {
    padding: 16px 12px;
    text-align: left;
    font-weight: 600;
    color: var(--text-primary);
    user-select: none;
}

.table-header-cell.sortable {
    cursor: pointer;
    transition: var(--transition);
}

.table-header-cell.sortable:hover {
    background-color: #e6e6e6;
}

.header-content {
    display: flex;
    align-items: center;
    gap: 6px;
}

.sort-icon {
    font-size: 12px;
    opacity: 0.6;
    transition: var(--transition);
}

.table-header-cell.sortable:hover .sort-icon {
    opacity: 1;
}

.table-row {
    border-bottom: 1px solid var(--border-color);
    transition: var(--transition);
}

.table-row:hover {
    background-color: #f9f9f9;
}

.table-row.even {
    background-color: #fafafa;
}

.table-row.odd {
    background-color: var(--bg-white);
}

.table-cell {
    padding: 14px 12px;
    color: var(--text-secondary);
    font-size: 14px;
}

/* ============ 状态徽章 ============ */

.status-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 500;
}

.status-active {
    background-color: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.status-offline {
    background-color: #fafafa;
    color: #595959;
    border: 1px solid #d9d9d9;
}

/* ============ 分页 ============ */

.pagination {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid var(--border-color);
}

.pagination-controls {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 16px;
}

.pagination-btn {
    padding: 8px 16px;
    border: 1px solid var(--border-color);
    background: var(--bg-white);
    color: var(--text-primary);
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    font-weight: 500;
    transition: var(--transition);
}

.pagination-btn:hover:not(:disabled) {
    border-color: var(--primary-color);
    color: var(--primary-color);
    background-color: var(--bg-light);
}

.pagination-btn:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.page-info {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
    min-width: 120px;
    text-align: center;
}

/* ============ 文档区域 ============ */

.doc-content,
.api-content {
    line-height: 1.8;
}

.doc-content h3,
.api-content h3 {
    font-size: 18px;
    margin-top: 20px;
    margin-bottom: 12px;
    color: var(--text-primary);
}

.doc-content pre,
.api-content pre {
    background: #f5f5f5;
    border: 1px solid var(--border-color);
    border-radius: 4px;
    padding: 16px;
    overflow-x: auto;
    margin: 12px 0;
}

.doc-content code,
.api-content code {
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 13px;
    color: #d63384;
}

.doc-content pre code,
.api-content pre code {
    color: var(--text-primary);
}

.doc-content a,
.api-content a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

.doc-content a:hover,
.api-content a:hover {
    text-decoration: underline;
}

/* ============ 页脚 ============ */

.footer {
    background: var(--bg-light);
    border-top: 1px solid var(--border-color);
    padding: 30px 20px;
    text-align: center;
    color: var(--text-secondary);
    margin-top: 40px;
    border-radius: 4px;
}

.footer p {
    font-size: 14px;
}

/* ============ 响应式设计 ============ */

@media (max-width: 768px) {
    .header h1 {
        font-size: 24px;
    }

    .nav-list {
        flex-wrap: wrap;
    }

    .nav-link {
        padding: 12px 16px;
        font-size: 13px;
    }

    .controls {
        flex-direction: column;
    }

    .search-input,
    .sort-select,
    .btn {
        width: 100%;
    }

    .demo-section,
    .docs-section,
    .api-section {
        padding: 20px;
    }

    .table-wrapper {
        font-size: 12px;
    }

    .table-cell,
    .table-header-cell {
        padding: 10px 8px;
    }

    .pagination-controls {
        flex-wrap: wrap;
        gap: 8px;
    }

    .pagination-btn {
        padding: 6px 12px;
        font-size: 12px;
    }

    .page-info {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }

    .header {
        padding: 20px 10px;
    }

    .header h1 {
        font-size: 20px;
    }

    .header .subtitle {
        font-size: 12px;
    }

    .demo-section,
    .docs-section,
    .api-section {
        padding: 15px;
    }

    .demo-section h2,
    .docs-section h2,
    .api-section h2 {
        font-size: 18px;
    }

    .table-wrapper {
        font-size: 11px;
    }

    .table-cell,
    .table-header-cell {
        padding: 8px 6px;
    }
}

/* ============ 搜索栏 ============ */

.search-bar {
    margin-bottom: 30px;
    display: flex;
    justify-content: center;
}

.search-bar .search-input {
    width: 100%;
    max-width: 500px;
    padding: 12px 16px;
    border: 2px solid var(--border-color);
    border-radius: 24px;
    font-size: 14px;
    transition: var(--transition);
}

.search-bar .search-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* ============ 组件网格 ============ */

.components-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
}

.component-card {
    background: var(--bg-white);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 20px;
    box-shadow: var(--shadow-sm);
    transition: var(--transition);
    display: flex;
    flex-direction: column;
}

.component-card:hover {
    box-shadow: var(--shadow-md);
    transform: translateY(-4px);
    border-color: var(--primary-color);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px;
}

.version-badge {
    background: var(--primary-color);
    color: white;
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge {
    padding: 4px 12px;
    border-radius: 12px;
    font-size: 12px;
    font-weight: 600;
}

.status-badge.new {
    background: #f6ffed;
    color: #52c41a;
    border: 1px solid #b7eb8f;
}

.status-badge.coming {
    background: #e6f7ff;
    color: #1890ff;
    border: 1px solid #91d5ff;
}

.card-title {
    font-size: 18px;
    font-weight: 600;
    margin-bottom: 8px;
    color: var(--text-primary);
}

.card-description {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 12px;
    line-height: 1.5;
}

.card-features {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 16px;
}

.feature-tag {
    background: var(--bg-light);
    color: var(--text-secondary);
    padding: 4px 10px;
    border-radius: 4px;
    font-size: 12px;
}

.card-footer {
    display: flex;
    gap: 8px;
    margin-top: auto;
}

.card-footer .btn {
    flex: 1;
    padding: 8px 12px;
    font-size: 13px;
    text-align: center;
    text-decoration: none;
    display: inline-block;
}

.btn-secondary {
    background: var(--bg-light);
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-secondary:hover {
    background: var(--primary-color);
    color: white;
}

.btn-disabled {
    background: var(--bg-light);
    color: var(--text-secondary);
    cursor: not-allowed;
    opacity: 0.6;
}

/* ============ 统计信息 ============ */

.stats-section {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 20px;
    margin-bottom: 40px;
    padding: 30px;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    border-radius: 8px;
}

.stat-item {
    text-align: center;
}

.stat-number {
    font-size: 36px;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 8px;
}

.stat-label {
    font-size: 14px;
    color: var(--text-secondary);
    font-weight: 500;
}

/* ============ 响应式 ============ */

@media (max-width: 768px) {
    .components-grid {
        grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
        gap: 16px;
    }

    .card-title {
        font-size: 16px;
    }

    .card-description {
        font-size: 13px;
    }

    .stats-section {
        grid-template-columns: 1fr;
        gap: 16px;
        padding: 20px;
    }
}

@media (max-width: 480px) {
    .components-grid {
        grid-template-columns: 1fr;
    }

    .search-bar .search-input {
        max-width: 100%;
    }

    .card-footer {
        flex-direction: column;
    }

    .card-footer .btn {
        width: 100%;
    }

    .stats-section {
        grid-template-columns: 1fr;
    }
}
